Machine learning predictive model for evaluating the cooking characteristics of moisture conditioned and infrared heated cowpea

Cowpea is widely grown and consumed in sub-Saharan Africa because of its low cost and high mineral, protein, and other nutritional content. Nonetheless, cooking it takes considerable time, and there have been attempts on techniques for speeding up the cooking process without compromising its nutritious value. Infrared heating has recently been proposed as a viable way of preparing instantized cowpea grains that take a short amount of time to cook while maintaining desired sensory characteristics. Despite this, only a few studies have shown the impact of moisture, temperature, and cooking time on cooking characteristics such as bulk density, water absorption (WABS), and the pectin solubility of infrared heated cowpea precooked using this technology. Artificial neural network was used as a machine learning tool to study the effect of a prediction model on the infrared heating performance and cooking characteristics of precooked cowpea seeds. With R values of 0.987, 0.991, and 0.938 for the bulk density, WABS, and pectin solubility, respectively, the prediction model created in this study utilizing an artificial neural network (a type of machine learning) outperformed the traditional linear, 2-factor interaction, and quadratic models.

Response surface methodology (RSM) is one of the utilized conventional optimization model techniques in pulses processing that has been useful in predicting and optimizing processing parameters such as germination 14 , drying 15 , extrusion 16 and infrared heating 8,13 of pulses to improve quality and developing new products. However, the performance of models developed using RSM is limited. Recently, with the advent of the 4 th industrial revolution, artificial neural network (ANN) has been considered as a more efficient tool for model predictions of biodiesel production 17 and even in food processing 18 . ANN is a mathematical algorithm which has the capability of relating the input and output parameters, learning from examples through iteration, without requiring a prior knowledge of the relationships of the process parameters 18 . ANN models have been used for process control in thermal food processing including modelling tool in several food processing applications like drying 19,20 , heat transfer and thermal process predictions 18,21 . Furthermore, artificial intelligence is one of the approaches which has proven to be efficient with improving the processing quality of grains like wheat in the development of food products 22,23 . Application of ANN for food processes such as legume processing have been reported 24,25 . Nonetheless, to the best of our knowledge, there is still a dearth of information available on predicting the properties of pulses prepared by infrared heating using artificial intelligence, which is critical for improving the cooking characteristics of pulses such as cowpea, as an important source of protein. Therefore, this study aimed at developing a predictive model for evaluating the cooking characteristics of cowpea (specifically bulk density, water absorption capacity and pectin solubility) under varied processing parameters of moisture content, temperature, and time within a closed system of an infrared heater.

Materials and methods
Materials. Cowpea (Vigna unguiculata: Agrinawa variety) seeds were received from the South African Agricultural Research Council's Institute for Tropical and Subtropical Crops in Nelspruit, South Africa. The seeds were manually selected to remove faulty seeds and kept at 4 °C until moisture preconditioning, and infrared heat treatment were done. Experimental design and sample preparation. Using Statistica version 7 statistical software, a series of experiments were statistically constructed based on RSM-central composite design (CCD) (StatSoft, Tulsa, USA). Level of moisture, infrared heating temperature, and time were the independent variables of pre-treatments investigated, with intervals of 32-57%, 114-185 °C, and 2-18 min, respectively ( Table 1). The selection of the parameter levels was based on other studies in the literature on the production of infrared heated cowpea seeds 3,8,11,12 . Bulk density, WABS, and pectin solubility were the dependent variables of pretreatments assessed in this study. The combination of variables resulted in the creation of fifteen (15) experimental runs, each of which was carried out in triplicate, resulting in the generation of 45 rows of experimental data ( Table 2). The cowpea seeds were first soaked in water to attain 32, 40, 45, 54, and 57% moisture (dry basis) using the method reported by Mwangwela, Waniska 11 and infrared heated using a closed system infrared heater power output 3KW (MW184, Delphius Technologies, Pretoria, South Africa) for each experimental run (Table 2). A schematic diagram of the infrared heating system used in this study is shown in Fig. 1. It has three infrared emitters (Quartz tube infrared emitters) with power outputs ranging between 0 to 3 KW, short wave infrared with a wavelength peak emission at 2.9 µm. The samples produced were maintained at 4 °C in an airtight container until further analysis.
Analyses. Bulk density of cowpea seed samples was determined using the method described by Alves, Da Silva et al. 26 . Water absorption capacity of cowpea seed samples was determined using the method described by Ogundele and Emmambux 27 . Soluble pectin, hot water-soluble pectin (HWSP) of cowpea seed samples was determined as described by Ndungu Emmambux and Minnar 12 . The experimental data obtained from the analyses are presented in Table 2.
Artificial neural network (ANN) modeling. ANN is a supervised form of machine learning driven by the availability of dataset, where raw dataset is the input into the neural system used in developing a predictive model, and subsequently a set of predicted outputs. The neural system consists of hidden layers of neurons that are useful in learning the patterns specific to the raw data and assists in producing possible related outputs 28,29 . www.nature.com/scientificreports/ A simple representation of the neural network structure used in our paper is presented in Fig. 2. Differences between the output value in the raw data and the new set of output produced after subjecting our data to ANN algorithm results in an error 29 .
Data cleaning. The raw data was cleaned and utilized as the input for machine learning prediction using ANN. The predictive variables are moisture temperature and time, while the response variables are bulk density, WABS, and pectin solubility ( Table 1). The descriptive property of the raw data is presented in Table 1, while the raw data used as input is presented in Table 2. www.nature.com/scientificreports/ Data processing. The processing of data using ANN includes data training, data validation, and data testing. For this research work, MATLAB software was used for ANN modeling. The algorithm used for data processing is the Levenberg-Marquardt algorithm, owing to its swiftness and steadiness in convergence 30 . For data training, the raw data is given as input to the neural network system. During this stage, it fine-tunes the data in retrospect to the error produced. The validation process estimates network's generalization, besides, signifies when the training process should stop once there is no more progress in data generalization, lastly, data testing   www.nature.com/scientificreports/ evaluates and offers a stand-alone measure of the network's performance before, during and after data training. For data training, validation, and testing, the dataset was rationed in 70, 15, and 15% respectively. 10 hidden neurons were used for deriving the best predictive model for bulk density and WABS, while three neurons (5,8, and 10) were used for pectin solubility (Fig. 2). This was to produce improved predictive model for pectin solubility.
Performance of predictive model. Understanding the performance of a model is key to improve prediction accuracy. The performance indicators used to evaluate the accuracy of the predictive model developed in this work includes mean square error (MSE), coefficient of correlation (R) and coefficient of determination (R 2 ). Besides, the performance of the ANN model developed was compared with the performance of conventional models such as linear, two factor interaction (2FI), quadratic and cubic model using R 2 . This was to affirm the accuracy of utilizing ANN for developing a predictive model for estimating the bulk density, WABS, and pectin solubility of cowpea precooked using infrared heating.
Ethical guideline statement. The author (s) declare the plant material used in this research complied with relevant institutional, national, and international guidelines and legislation.

Result and discussion
A predictive model was developed using ANN for the bulk density, WABS and pectin solubility of cowpea precooked using infrared heating. Three main factors that influence the response were fed into the neural network as the independent variables, the experimental data of the process was cleaned and processed using fitnet ANN model. The MSE, R and R 2 of the training, validation, and testing datasets are presented in (Table 3). However, the overall R and R 2 value was utilized in selecting the best predictive model for each of the response variable. Besides, scatter plots with coefficient of correlation are presented in (Fig. 3). The plot of the best validation performance, together with the actual, predicted response and error (difference between the predicted and actual response) plot are presented in Figs. 4 and 5 respectively. From the evaluation result, for the bulk density obtained after training, validating, and testing the model using 10 neurons, the overall R and R 2 values are greater than 0.9, implying that ANN was efficient in developing a predictive model for the bulk density of cowpea prepared using infrared heating.
Specifically, the highest overall R and R 2 values are 0.987 and 0.974 respectively with a validation MSE of 1.06E-05. This was compared with the R 2 obtained using linear, 2FI and quadratic model (Table 4). Comparatively, the R 2 of the predictive model generated using ANN was approximately higher by 21%, 13%, and 3% for linear, 2FI and quadratic model respectively. www.nature.com/scientificreports/ www.nature.com/scientificreports/ For WABS, the overall R and R 2 ranged between 0.5 and 0.9991. After repeated training, validation and testing (10 neuron), a significantly high R and R 2 values were eventually obtained at the 5 th iteration with R and R 2 values of 0.999 and 0.998 respectively with a validation MSE of 3.75 Similar to the bulk density, the R 2 value was compared with that obtained using linear, 2FI and quadratic model (Table 4). Comparatively, the R 2 of the predictive model generated using ANN was approximately higher by 28%, 23%, and 11% for linear, 2FI and quadratic model respectively. Studies reported that ANN is an accurate and model with satisfactory prediction. The training, testing and validation results model prediction obtained at about 6-15 neurons, regression of coefficient and lower error in prediction of about 0.9 and 0.02 respectively indicating better ANN prediction of the hydration behavior of green chickpea and soybean seeds at varying soaking temperature and time 24,25 .
For Pectin solubility, the coefficient of regression for the linear, 2FI and quadratic model for pectin solubility are very low, ranging from 0.30 to 0.49, however, using ANN, a high R and R 2 was obtained after training, validating, and testing the model using three different neurons (5,8 and 10 neurons). The three different neurons employed for pectin solubility were utilized to obtain a significant overall model performance indicator (R and R 2 ). The best overall R and R 2 values were obtained using 10 neurons and at the 5th run, with values of 0.938 and 0.88 respectively, and validation MSE of 245. Comparatively the R 2 value of the model predicted using ANN was approximately higher by 64%, 54%, and 44% for linear, 2FI and quadratic model respectively. The predictive model developed using ANN are presented in equation. Although there is no report on using ANN for predicting pectin solubility of processed legumes making this finding the first report, however a study using hybrid ANN, RSM and genetic algorithm reported R 2 value of about 0.94 for predicting percentage protein retention of soybeans subjected to optimization of soaking conditions and considered ANN as alternative to the time-consuming soaking process, extensively practiced in industries, in terms of process time economy 25 .
The results of comparison between the actual and predicted values as shown in Fig. 6, indicated that the values of the parameters measured in this study (bulk density, WABS and pectin solubility) are closely related. Reportedly, ANN has been utilized in various fields, nonetheless reports on using ANN for predicting the cooking properties of cowpea when moisture content, temperature and time are varied during infrared heating was not found. This study fills that gap by presenting a method of using artificial intelligence technologies (specifically ANN) for predicting the bulk density, WABS and pectin solubility of cowpea precooked via the use of infrared form of heating under varied independent parameters of moisture content, temperature, and time.
X comprises of the three dependent variables of moisture, temperature, and time , while y 1 = Bulkdensity , y 2 = WABS , y 2 = Pectinsolubility . net stands for the neural network model developed using ANN after training, validating, and testing raw dataset obtained from the experiment carried out in this study. (1)

Conclusion
Industry 4.0 epitomizes the fourth wave of industrial revolution and aims at applying computerized, artificial intelligent, and data-driven technologies to research and industrial operations in order to optimize productivity and efficiency. One of these technologies is artificial neural network that works on the principle of self-learning to develop accurate predictive models that can describe and predict the relationship and behavior of a system. For the first time, artificial neural network was utilized in this work to develop a model that predicts the behavior (bulk density, water absorption capacity and pectin solubility) of cowpea prepared using infrared heating). Unlike the traditional linear, 2FI and quadratic model, artificial neural network (ANN proved more accurate and developed a better predictive model in the model prediction with a highly significant model performance (R value of 0.9874, 0.9991 and 0.9380 for bulk density, water absorption capacity and pectin solubility) of infrared-cooked cowpea. The predictive model generated can predict similar response variables subjected to similar or almostclose process parameters (moisture content, temperature, and time) and paves the path for the optimization of the characteristics of infrared-cooked cowpea using artificial intelligence technologies.

Data availability
The datasets generated during and/or analyzed during the current study is available from the corresponding author on reasonable request.